package com.sky.controller.user;

import com.sky.result.Result;
import com.sky.service.ShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @Author mr.wu
 * @Data #{DATE} #{TIME}
 */
@RestController
@RequestMapping("/user/shop")
@Slf4j
public class ShopConroller {

    @Autowired
    private ShopService shopService;
    @Autowired
    private StringRedisTemplate redisTemplate;

    public static final String KEY = "SHOP_STATUS";
    @GetMapping("/status")
    public Result getStatus(){
        String s = redisTemplate.opsForValue().get(KEY);
        Integer status = Integer.valueOf(s);
        log.info("获取店铺的营业状态为：{}",status == 1 ? "营业中" : "打烊中");
        return Result.success(status);
    }
}
